<template>
    <div>
        <index-header :list="list_city"></index-header>
        <home-banner :list="list_banner"></home-banner>
        <home-nav :list="list_nav"></home-nav>
        <home-recommend :list="list_recommend"></home-recommend>
        <home-week :list="list_week"></home-week>
    </div>
</template>

<script>
import indexHeader from './components/indexHeader'
import homeBanner from './components/homeBanner'
import homeNav from './components/homeNav'
import homeRecommend from './components/homeRecommend'
import homeWeek from './components/homeWeek'
import axios from 'axios'
export default {
  name: 'index',
  components: {
    indexHeader,
    homeBanner,
    homeNav,
    homeRecommend,
    homeWeek
  },
  data () {
    return {
      list_city: '',
      list_banner: [],
      list_nav: [],
      list_recommend: [],
      list_week: []
    }
  },
  methods: {
    getHomeInfo () {
      axios.get('/api/index.json')
        .then(this.getHomeInfoSucc)
    },
    getHomeInfoSucc (res) {
      res = res.data
      if (res.ret) {
        this.list_nav = res.data.iconList
        this.list_banner = res.data.swiperList
        this.list_recommend = res.data.recommendList
        this.list_week = res.data.weekendList
      }
    }
  },
  mounted () {
    this.getHomeInfo()
  }
}
</script>

<style scoped>

</style>
